
cc.Class({
    extends: cc.Component,

    properties: {
        id: 0,
        arrayI: 0,
        arrayJ: 0,

        number:0,
        IsSurePut:true,
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start() {
        this.IsSurePut = true;//可以放入
    },
    //显示子物体
    subObject(_number){
        this.IsSurePut = false;
        this.number=_number;

        let _sub=cc.find("innercell",this.node);//显示子物体
        _sub.active=true;

        let _color;
        for(let i=0;i<cellColor.length;i++){
            if(this.number==cellColor[i].num){
                _color=cellColor[i].color;
            }
        }
        _sub.color=cc.color(_color);

        let _subNumber=cc.find("innercell/number",this.node);//数字
        _subNumber.getComponent(cc.Label).string=this.number;

        this.replyColor();
    },
    //隐藏子物体
    hideObject(){
        this.IsSurePut = true;
        let _sub=cc.find("innercell",this.node);//显示子物体
        _sub.active=false;
    },
    //克隆子物体 移动
    cloneMoveSubObject(){
        let _sub=cc.find("innercell",this.node);//子物体

        let cioneSub=cc.instantiate(_sub);
        let _innerCellInterface=cc.find("Canvas/innerCellInterface");
        _innerCellInterface.setPosition(this.node.x,this.node.y);
        _innerCellInterface.addChild(cioneSub);

        _sub.active=false;//隐藏子物体
    },

    //回复颜色
    replyColor() {
        this.node.color = cc.color("#ffffff");
    },
    //第一次碰撞
    onCollisionEnter: function (other, self) {
        if (this.IsSurePut == true) {
           // console.log("碰撞");
            this.node.color = cc.color("#0000ff");
        }

    },
    //持续碰撞
    onCollisionStay: function (other, self) {

    },
    //离开碰撞
    onCollisionExit: function (other, self) {
        if (this.IsSurePut == true) {
            this.node.color = cc.color("#ffffff");
        }

    },

    // update (dt) {},
});
